<ResourceDictionary  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                     xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
                     xmlns:ec="http://schemas.microsoft.com/expression/2010/controls"
                     xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
                     xmlns:local="clr-namespace:MainGameModule">

    <Style TargetType="local:KidControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:KidControl">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid x:Name="kidGrid"
                              RenderTransformOrigin="0.5,0.5">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <StackPanel Opacity="0"
                                        x:Name="playerHaader"
                                        Orientation="Horizontal">
                                <TextBlock VerticalAlignment="Bottom"
                                           FontFamily="Segoa UI"
                                           Foreground="White"
                                           FontWeight="Bold"
                                           x:Name="nameField"
                                           Margin="3" />
                                <Image x:Name="connectImage"
                                       Source="/MainGameModule;component/Images/hand.png"
                                       Width="35"
                                       Height="35"
                                       VerticalAlignment="Bottom"
                                       Margin="3"
                                       ToolTipService.ToolTip="Connect" />
                            </StackPanel>

                            <Image x:Name="kidImage"
                                   Grid.Row="1"
                                   RenderTransformOrigin="0.5,0.5"
                                   Width="50"
                                   Height="60"
                                   Stretch="Fill">
                            </Image>

                            <Grid.RenderTransform>
                                <CompositeTransform ScaleY="-1"
                                                    TranslateY="0">
                                </CompositeTransform>
                            </Grid.RenderTransform>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:SplineAnimation">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:SplineAnimation">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Image x:Name="SplineImage"
                               RenderTransformOrigin="0.5,0.5">
                            <Image.RenderTransform>
                                <CompositeTransform>
                                </CompositeTransform>
                            </Image.RenderTransform>
                        </Image>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <DataTemplate x:Key="BinItemTemplate">
        <Grid>
            <TextBlock Text="{Binding Name}"
                       FontWeight="Bold"
                       Foreground="White"
                       FontFamily="Segoa UI"/>
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="BinContentTemplate">
        <Rectangle Height="10"
                   Width="{Binding ContentWidth}"
                   Fill="{Binding Color}" />
    </DataTemplate>

    <DataTemplate x:Key="PieItemTemplate">
        <ed:Arc ArcThickness="{Binding FillPercent}"
                ArcThicknessUnit="Percent"
                EndAngle="22"
                Height="100"
                Stroke="Black"
                StartAngle="-22"
                Width="100"
                Fill="{Binding Color}" />
    </DataTemplate>

    <ItemsPanelTemplate x:Key="ItemsPanelTemplate">
        <StackPanel Background="Transparent" />
    </ItemsPanelTemplate>
    <Style x:Key="ListBoxItemStyle"
           TargetType="ListBoxItem">
        <Setter Property="Padding"
                Value="0.2" />
        <Setter Property="HorizontalContentAlignment"
                Value="Right" />
        <Setter Property="VerticalContentAlignment"
                Value="Top" />
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="BorderThickness"
                Value="0" />
        <Setter Property="TabNavigation"
                Value="Local" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Grid Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter x:Name="contentPresenter"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Content="{TemplateBinding Content}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ListBoxItemStyle2"
           TargetType="ListBoxItem">
        <Setter Property="Padding"
                Value="3" />
        <Setter Property="VerticalContentAlignment"
                Value="Top" />
        <Setter Property="HorizontalContentAlignment"
                Value="Left" />
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="BorderThickness"
                Value="0" />
        <Setter Property="TabNavigation"
                Value="Local" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Grid Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter x:Name="contentPresenter"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Content="{TemplateBinding Content}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ec:IsArrangedToScaleConverter x:Key="IsArrangedToScaleConverter" />
    <Style x:Key="PathListBoxItemStyle"
           TargetType="ec:PathListBoxItem">
        <Setter Property="HorizontalContentAlignment"
                Value="Left" />
        <Setter Property="VerticalContentAlignment"
                Value="Top" />
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="BorderThickness"
                Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ec:PathListBoxItem">
                    <Grid Background="{TemplateBinding Background}"
                          RenderTransformOrigin="0.5,0.5">
                        <Grid.RenderTransform>
                            <TransformGroup>
                                <ScaleTransform ScaleY="{Binding IsArranged, Converter={StaticResource IsArrangedToScaleConverter}, RelativeSource={RelativeSource TemplatedParent}}"
                                                ScaleX="{Binding IsArranged, Converter={StaticResource IsArrangedToScaleConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
                                <SkewTransform />
                                <RotateTransform Angle="{Binding OrientationAngle, RelativeSource={RelativeSource TemplatedParent}}" />
                                <TranslateTransform />
                            </TransformGroup>
                        </Grid.RenderTransform>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="fillColor"
                                   Fill="#FFBADDE9"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusY="1"
                                   RadiusX="1" />
                        <Rectangle x:Name="fillColor2"
                                   Fill="#FFBADDE9"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusY="1"
                                   RadiusX="1" />
                        <ContentPresenter x:Name="contentPresenter"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Content="{TemplateBinding Content}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}" />
                        <Rectangle x:Name="FocusVisualElement"
                                   RadiusY="1"
                                   RadiusX="1"
                                   Stroke="#FF6DBDD1"
                                   StrokeThickness="1"
                                   Visibility="Collapsed" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:BarResultsControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:BarResultsControl">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid Margin="0,10,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <ListBox x:Name="BinItemsListBox"
                                     Background="Transparent"
                                     BorderThickness="0"
                                     HorizontalContentAlignment="Right"
                                     ItemTemplate="{StaticResource BinItemTemplate}"
                                     ItemsPanel="{StaticResource ItemsPanelTemplate}"
                                     ItemContainerStyle="{StaticResource ListBoxItemStyle}" />

                            <ListBox x:Name="BinsContentListBox"
                                     Grid.Column="1"
                                     Background="Transparent"
                                     BorderThickness="0"
                                     Width="100"
                                     HorizontalContentAlignment="Left"
                                     ItemTemplate="{StaticResource BinContentTemplate}"
                                     ItemsPanel="{StaticResource ItemsPanelTemplate}"
                                     ItemContainerStyle="{StaticResource ListBoxItemStyle2}" />


                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:PieResultsControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:PieResultsControl">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">

                        <ec:PathListBox Margin="3"
                                        x:Name="BinsListBox"
                                        ItemTemplate="{StaticResource PieItemTemplate}"
                                        ItemContainerStyle="{StaticResource PathListBoxItemStyle}">
                            <ec:PathListBox.LayoutPaths>
                                <ec:LayoutPath SourceElement="{Binding ElementName=elipse}"
                                               Orientation="OrientToPath"
                                               Padding="-96.5"
                                               Span="0.98"
                                               Start="0.04" />
                            </ec:PathListBox.LayoutPaths>
                        </ec:PathListBox>
                        <ToolTipService.ToolTip>
                            <ToolTip Width="330"
                                     Height="150"
                                     x:Name="toolTip">
                                <ToolTip.Template>
                                    <ControlTemplate TargetType="ToolTip">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="*" />
                                            </Grid.RowDefinitions>
                                            <Path x:Name="BackgroundRectangle"
                                                  Grid.RowSpan="2"
                                                  Data="M187.2383,141.7393C187.2383,141.7393,176.3913,144.7943,172.5713,149.0723C164.2383,158.4063,166.5713,209.7393,165.2383,221.7393C163.9053,233.7393,163.9053,364.4073,165.2383,397.0733C166.5713,429.7393,165.2383,441.7393,167.9053,452.4053C170.5713,463.0733,178.5713,462.4053,187.2383,465.7393C195.9053,469.0733,317.9053,475.0733,335.2383,475.0733C352.5713,475.0733,497.2383,476.4073,523.9053,475.0733C550.5723,473.7393,617.2393,476.4053,630.5723,469.7393C643.9053,463.0733,651.2383,452.4053,651.2383,435.7393C651.2383,419.0733,652.5713,301.0723,651.2383,249.0723C649.9053,197.0723,651.8313,159.3863,645.9053,150.4063C641.9333,144.3863,629.2383,143.7393,617.9053,141.7393C606.5723,139.7393,419.9053,137.7393,381.2383,138.4063C342.5713,139.0723,187.2383,141.7393,187.2383,141.7393z"
                                                  Stretch="Fill">
                                                <Path.Effect>
                                                    <DropShadowEffect />
                                                </Path.Effect>
                                                <Path.Fill>
                                                    <RadialGradientBrush RadiusX="0.8">
                                                        <GradientStop Color="#FFD1E778" />
                                                        <GradientStop Color="#FF4A6305"
                                                                      Offset="1" />
                                                    </RadialGradientBrush>
                                                </Path.Fill>
                                            </Path>

                                            <TextBlock Text="Your Recycling Status"
                                                       FontWeight="Bold"
                                                       Foreground="White"
                                                       FontFamily="Segoa UI"
                                                       HorizontalAlignment="Center"
                                                       Margin="10" />
                                            <ListBox BorderThickness="0"
                                                     ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                                                     ScrollViewer.VerticalScrollBarVisibility="Hidden"
                                                     Grid.Row="1"
                                                     Background="Transparent"
                                                     ItemsSource="{Binding ItemsSource, ElementName=BinsListBox}">
                                                <ListBox.ItemsPanel>
                                                    <ItemsPanelTemplate>
                                                        <StackPanel Orientation="Horizontal" />
                                                    </ItemsPanelTemplate>
                                                </ListBox.ItemsPanel>
                                                <ListBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <StackPanel>
                                                            <Rectangle Height="30"
                                                                       HorizontalAlignment="Center"
                                                                       Width="30"
                                                                       Fill="{Binding Color}" />
                                                            <TextBlock Text="{Binding Name}"
                                                                       MaxWidth="100"
                                                                       TextWrapping="Wrap"
                                                                       FontWeight="Bold"
                                                                       Foreground="White"
                                                                       FontFamily="Segoa UI" />
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </ListBox.ItemTemplate>
                                            </ListBox>
                                        </Grid>
                                    </ControlTemplate>
                                </ToolTip.Template>
                            </ToolTip>
                        </ToolTipService.ToolTip>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
